Ext.define('appmod.view.knowledge.TreeDashboard', {
    extend: 'Ext.panel.Panel',
    alias: ['widget.knowledge.treedashboard','widget.knowledge-treedashboard'],
    region : 'center',
    layout : {
		type:'border'
	},
	requires: [
		'appmod.view.knowledge.category.TreeGrid'
	],	
	border : false,
	margins:"5 5 5 5",

	constructor: function (config) {
		
		if (config.fieldStores) {
			this.stores = config.stores;
		}
        this.callParent(arguments);
     },	

    initComponent: function() {
        var me = this;
		
		// --- binding store ---
		var dsCategory = me.stores['category'];
	
        Ext.applyIf(me,{
			items:[
				{
					store:dsCategory,
			        rootVisible: false,
			        useArrows: true,
			        //frame: true,
					title:'文件分类',
					collapsible:true,					
					xtype:'knowledge.tree.grid',
					region:'west',
					split:true,
					width:200,
					dockedItems:[{
					    xtype: 'toolbar',
					    dock: 'top',
						items:[
						{
							xtype:'button',
							text:'添加',
							action:'addCategory'							
						},
						{
							xtype:'button',
							text:'删除',
							action:'deleteCategory'							
						}
						]						
					}]
				},
				{
					xtype:'knowledge.content.bigview',
					region:'center',
					title:'附件',
					margins:"0 0 0 0",
					border : true,
					dockedItems: [{
					    xtype: 'toolbar',
					    dock: 'top',
					    items: [
                            {
                                xtype: 'button',
                                text: '上传附件',
								action : 'uploadMultiFiles'
                            },					
							{
								xtype:'button',
								text:'删除',
								action:'deleteFiles'
							},
							{
								xtype:'button',
								text:'关联知识点',
								action:'bindColligation'
							},										
							'-',
							{
								xtype:'combobox',
								name:'fileFormat',
								labelWidth:60,
								allowBlank:false,
								editable:false,
							    displayField: 'name',
							    valueField: 'id',
								value:'all',
						        typeAhead: true,
						        mode: 'local',
						        triggerAction: 'all',
						        emptyText:'显示分类',
						        selectOnFocus:true,
						        width:180						
							}
					    ]
					}]						
				}
			]
			
		});

        me.callParent(arguments);

    }
});